<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>0417</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <div style="width: 100px;height: 100px;background-color: red;" v-show="flag">
            欢迎来到未来梦大厦
        </div>
        <hr>
        <!-- v-if 与v-show区别。 -->
        <button v-on:click="change">显示</button>
        <button @click="flag=false">隐藏</button>
        <button v-on:click="flag=!flag">隐藏/显示</button>
    </div>
    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                flag: true
            },
            methods: {
                change(){
                    this.flag = !this.flag
                }
            }
        })
    </script>
</body>

</html>